package com.titar.kslikeview.widigets;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.LinearLayout;

import static com.titar.kslikeview.widigets.NumberRainItem.tvSize;

public class NumberRainLayout extends LinearLayout {
    public NumberRainLayout(Context context) {
        this(context,null);
    }

    public NumberRainLayout(Context context, AttributeSet attrs) {
        this(context, attrs,0);
    }

    public NumberRainLayout(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        init();
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
    }

    private void init(){
        int c = getMeasuredWidth()/tvSize;
        for (int i=0;i<c;i++){
            addView(new NumberRainItem(getContext()));
        }
    }

}
